# this script filters consitent patterns out of each available version
# and creates a knitr report on them.

library(knitr)
library(ggplot2)

path <- "/home/voellenk/Dropbox/constellation/bestPatterns"
outp <- "/home/voellenk/Dropbox/constellation/consistentBestPatterns"
knitfile <- "/home/voellenk/stratlab_workdir/stratlab/pattern_report/consistentBestPatterns.Rmd"

all.files <- list.files(path, rec=F)
bestPatternFiles <- all.files[grep('^v2_2.*_bestPatterns.Rdata$', all.files)]

# detect distinct versions (this will be c("v1_2", "v1_3", ...))
uniqueVersions <- unique(sub('_group.*', '', bestPatternFiles))
setwd(outp)

for (strategy in uniqueVersions) {
  print (paste("... doing strategy", strategy))
  filename <- paste(strategy, "consistentPatterns", sep="_")
  knit2html(knitfile, paste(outp, filename, sep="/"))
}

